// https://leetcode.cn/problems/container-with-most-water/

class Solution {
public:
    int maxArea(vector<int>& a) {
        int l = 0, r = a.size() - 1;
        int Max = -1;
        while(l < r) {
            Max = max((r - l) * min(a[l], a[r]), Max);
            if(a[r] > a[l]) {
                l++;
            }else {
                r--;
            }
        }
        return Max;
    }
}; 